﻿using System;
using System.Collections.Generic;
using System.Web;
using PayRoller.Code;
using System.Web.SessionState;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using HySoft.Cash.Business;
using HySoft.Cash.Structure;
using System.Configuration;
using System.Web.Profile;
using Huayou.Utils;
using HySoft.Cash;

namespace PayRoller.Manage.OrgInfo
{
    public class MyProfile : ParentPage, IRequiresSessionState
    {
        // Fields
        protected HtmlForm form1;
        protected Label lblTip;
        public string OrgSid = "";
        public string sABN = "";
        public string sAgreementDate = "";
        public string sAltEmail1 = "";
        public string sAltEmail2 = "";
        public string sContactPerson = "";
        public string sContactPhone1 = "";
        public string sContactPhone2 = "";
        public string sFax = "";
        public string Sid = "";
        public string sIndustry = "";
        public string sMobile = "";
        public string sOfficeAddress = "";
        public string sOrgName = "";
        public string sPosition = "";
        public string sPostalAddress = "";
        public string sPreferredEmail = "";
        public string sTradingName = "";
        public string sWebSite = "";

        // Methods
        protected override void OnInit(EventArgs e)
        {
            base.m_ModuleCode = "";
            base.CheckLogin(true);
            base.CheckPerm();
            base.OnInit(e);
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (base.Request["OrgSid"] != null)
            {
                this.OrgSid = base.Request["OrgSid"].ToString();
                try
                {
                    TorginfoBN obn = new TorginfoBN(this.Page);
                    TorginfoDT odt = obn.Get(Convert.ToInt32(this.OrgSid));
                    this.sAgreementDate = DateUtils.DateFormatWithCulture( odt.AgreementDate,AppSettings.CurrentCulture);
                    this.sOrgName = odt.OrgName;
                    this.sTradingName = odt.TradingName;
                    this.sABN = odt.ABN;
                    this.sIndustry = odt.Industry;
                    this.sOfficeAddress = odt.OfficeAddress;
                    this.sWebSite = odt.WebSite;
                    this.sContactPerson = odt.ContactPerson;
                    this.sPosition = odt.sPosition;
                    this.sPostalAddress = odt.PostalAddress;
                    this.sContactPhone1 = odt.ContactPhone1;
                    this.sContactPhone2 = odt.ContactPhone2;
                    this.sFax = odt.Fax;
                    this.sMobile = odt.Mobile;
                    this.sPreferredEmail = odt.PreferredEmail;
                    this.sAltEmail1 = odt.AltEmail1;
                    this.sAltEmail2 = odt.AltEmail2;
                    obn.Dispose();
                    obn = null;
                }
                catch (Exception exception)
                {
                    this.lblTip.Text = exception.Message;
                }
            }
        }

        // Properties
        protected HttpApplication ApplicationInstance
        {
            get
            {
                return this.Context.ApplicationInstance;
            }
        }

        protected DefaultProfile Profile
        {
            get
            {
                return (DefaultProfile)this.Context.Profile;
            }
        }
    }

}
